require 'net/http'
require 'uri'

def postfile host,xmlfile
#	host = 'herberthb.hostrator.com'
#	xmlfile = 'b.xml'
	phpfile = '/upload_file.php'
	data1 = '''-----------------------------187161971819895
Content-Disposition: form-data; name="file"; filename="'''
	
	data2 = '''"
Content-Type: text/xml

'''
	data3 =IO.read(xmlfile)
	data4 = '''
-----------------------------187161971819895
Content-Disposition: form-data; name="submit"

Submit
-----------------------------187161971819895--
'''
	data = data1 + xmlfile + data2 + data3 + data4 
	headers = {'Content-Type'=>'multipart/form-data; boundary=---------------------------187161971819895'}
	phpfile
	puts Net::HTTP.start(host) {|http|  puts  http.post(phpfile,data,headers) }
end

